<html>
<head><meta charset="utf-8"><title>-Zprint-llvm-passes and debugging LLVM · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html">-Zprint-llvm-passes and debugging LLVM</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212204358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204358">(Oct 04 2020 at 04:02)</a>:</h4>
<p>How would I actually make use of the output of <code>-Zprint-llvm-passes</code>?</p>



<a name="212204362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204362">(Oct 04 2020 at 04:02)</a>:</h4>
<p>To reproduce an LLVM crash</p>



<a name="212204368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204368">(Oct 04 2020 at 04:03)</a>:</h4>
<p>It prints a bunch of human-readable pass names, which I can't pass to LLVM, and occasionally "pass arguments" which don't seem to be recognized by <code>opt</code></p>



<a name="212204420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204420">(Oct 04 2020 at 04:04)</a>:</h4>
<p>The output I really want is "here's what you pass to opt/llc to do what we're about to do here" and the corresponding IR or bitcode going into each pass</p>



<a name="212204900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204900">(Oct 04 2020 at 04:18)</a>:</h4>
<p>Huh. Those are the same arguments printed with the <code>-debug-pass=Arguments</code> LLVM option, which is documented as <code>print pass arguments to pass to 'opt'</code></p>



<a name="212204911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204911">(Oct 04 2020 at 04:19)</a>:</h4>
<p>and yet the version of opt built with rustc doesn't recognize  them :/ :/ :/</p>



<a name="212204970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes%20and%20debugging%20LLVM/near/212204970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/-Zprint-llvm-passes.20and.20debugging.20LLVM.html#212204970">(Oct 04 2020 at 04:21)</a>:</h4>
<p>here's <a href="https://gist.github.com/tmandry/7e0b21c4ef5d826fd5c94b2e9ef0acb0">a gist</a> for anyone who would like to see what I'm doing</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>